package character;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;

import org.junit.Test;
import static org.junit.Assert.*;

import org.junit.Test;

public class DFATest {

	@Test
	/**
	 * Traversal testing of the DFA.
	 */
	public void traversalTest() {
		State state0 = new State(0);
		State state1 = new State(1);
		State state2 = new State(2);
		
		Input input0 = new Input("a", state1);
		Input input1 = new Input("b", state1);
		Input input2 = new Input("b", state2);
		Input input3 = new Input("a", state0);
		
		state0.addInput(input0);
		state0.addInput(input1);
		state1.addInput(input2);
		state2.addInput(input3);
		
		state0.setStartState(true);
		state2.setFinishState(true);
		
		List<State> states = new ArrayList();
		
		states.add(state0);
		states.add(state1);
		states.add(state2);
		DFA iDFA = new DFA(states);
		
		Boolean test = iDFA.traverse("ab");
		assertTrue(test);
		
		Boolean test2 = iDFA.traverse("aba");
		assertFalse(test2);
		
		Boolean test3 = iDFA.traverse("abc");
		assertFalse(test3);
		
		Boolean test4 = iDFA.traverse("aa");
		assertFalse(test4);
	}

}
